package com.solidsnake.scala.image

/**
 * Created with IntelliJ IDEA.
 * User: solidsnake
 * Date: 13-11-13
 * Time: 下午5:20
 * To change this template use File | Settings | File Templates.
 */
class DataModel(val name : String, val width : Int, val height : Int, val traitCode : String) {

  var caseTraitCount : Int = 0

  var caseBackCount : Int = 0

  /**
   * 相似度百分比(整数百分比）
   */
  def percentageSimilarity = {
    (caseTraitCount.toDouble / traitCode.filter(_ == '1').length  +
    caseBackCount.toDouble / traitCode.filter(_ == '0').length) * 100 / 2
  }

}
